﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BGA
{
    public partial class DebugImageForm : Form
    {
        public DebugImageForm(Image image)
        {
            InitializeComponent();

            pictureBox.Image = image;
            pictureBox.Size = image.Size;
        }

        public static void ShowForm(IWin32Window owner, Image image)
        {
            using (var frm = new DebugImageForm(image))
            {
                frm.ShowDialog(owner);
            }
        }

        private void pictureBox_MouseMove(object sender, MouseEventArgs e)
        {
            var bitmap = (Bitmap)pictureBox.Image;
            if (e.X >= bitmap.Width || e.Y >= bitmap.Height)
            {
                lblRGB.Text = "";
                return;
            }

            var color = ((Bitmap)pictureBox.Image).GetPixel(e.X, e.Y);
            lblRGB.Text = string.Format("{0}", color);
        }
    }
}
